package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.pojo.entity.QuestionBank;
import com.example.demo.pojo.entity.QuestionCategory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface QuestionCategoryMapper extends BaseMapper<QuestionCategory> {
    //根据名字查找ID
    @Select("SELECT id FROM test.question_category WHERE name = #{name}")
    Integer searchCategory(String name);
    //根据id查找名字
    @Select("SELECT name from test.question_category where id=#{id}")
    String searchName(int id);
    //查询全部
    @Select("select * from test.question_category")
    List<QuestionCategory>initQuestionCategory();
}
